﻿<!DOCTYPE html>
<html class="x-admin-sm">
<head>
<meta charset="UTF-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"	content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<link rel="stylesheet"	href="__PUBLIC__/css/font.css">
<link rel="stylesheet"	href="__PUBLIC__/css/xadmin.css">
<title>添加/修改角色</title>
<link href="__PLUGIN__/ztree/zTreeStyle.css" rel="stylesheet"	type="text/css">
<script src="__PUBLIC__/js/jquery.min.js"></script>
<script type="text/javascript" src="__PLUGIN__/ztree/jquery.ztree.core.js"></script>
<script type="text/javascript"	src="__PLUGIN__/ztree/jquery.ztree.excheck.min.js"></script>
<script	src="__PUBLIC__/lib/layui/layui.js"	charset="utf-8"></script>
<script type="text/javascript"	src="__PUBLIC__/js/xadmin.js"></script>
<script type="text/javascript">
		<!--
		var setting = {
			check: {
				enable: true
			},
			data: {
				simpleData: {
					enable: true
				}
			},
			 callback:{
                 beforeCheck:true,
                 onCheck:onCheck
			 }
		};

		var zNodes =[
		     {$zNodes|raw}
		];
		
		$(document).ready(function(){
			$.fn.zTree.init($("#treeDemo"), setting, zNodes);
		});
        function onCheck(e,treeId,treeNode){
            var treeObj=$.fn.zTree.getZTreeObj("treeDemo"),
            nodes=treeObj.getCheckedNodes(true),
            v="";
            var nid="";
            for(var i=0;i<nodes.length;i++){
              v+=nodes[i].name + ",";
              nid +=nodes[i].id + ","; //获取选中节点的值
            }
            $("input[name='nid']").val(nid);
        }
		//-->
	</script>

</head>
<body>
	<div class="x-nav">
		<span class="layui-breadcrumb"><a href="">首页</a> <a href="">系统管理</a><a><cite>角色管理</cite></a></span>
		<a class="layui-btn layui-btn-small" style="line-height: 1.6em; margin-top: 3px; float: right" onclick="location.reload()" title="刷新"> <i	class="layui-icon layui-icon-refresh" style="line-height: 30px"></i></a>
	</div>
	<div class="layui-fluid">
		<div class="layui-row">
			<form class="layui-form" method="post">
				<input type="hidden" name="id" value="{$Request.param.id}"> 
				<input	type="hidden" name="nid" value="">
				<div id="main">
					<div class="layui-form-item">
						<label for="username" class="layui-form-label"><span class="x-red">*</span>角色名称</label>
						<div class="layui-input-inline">
							<input type="text" name="title" value="{$roleInfo.name}"  lay-verify="required" class="layui-input" />
						</div>
					</div>
					
					<div class="layui-form-item">
						<label for="username" class="layui-form-label">状态</label>
						<div class="layui-input-inline">
							<select name="status">
								<option value="1" {eq name="roleInfo.status" value="1"}selected="selected"{/eq}>启用</option>
								<option value="0" {eq name="roleInfo.status" value="0"}selected="selected"{/eq}>关闭</option>
							</select>
						</div>
					</div>
					
					<div class="layui-form-item">
						<label for="username" class="layui-form-label"></label>
						<div class="layui-input-inline">
							<ul id="treeDemo" class="ztree"></ul>
						</div>
					</div>
				</div>
				<div class="hr hr-24"></div>
				<div class="layui-form-item">
					  <label for="L_repass" class="layui-form-label"></label>
                      <button  class="layui-btn" lay-filter="add" lay-submit="">保存</button>
				</div>
			</form>
		</div>
	</div>
    <script>
       layui.use(['laydate', 'form'],
        function() {
            var laydate = layui.laydate;

            //执行一个laydate实例
            laydate.render({
                elem: '#start' //指定元素
            });

            //执行一个laydate实例
            laydate.render({
                elem: '#end' //指定元素
            });
        });
     </script>	
</body>
</html>